<%--suppress ALL --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--suppress ALL --%>
<%--
  Created by IntelliJ IDEA.
  User: kingry lee
  Date: 2019/12/30
  Time: 9:28
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>我的订单</title>
    <link type="text/css" rel="stylesheet" href="../css/style.css" />
    <script type="text/javascript" src="../js/jquery.min.js"></script>

</head>
<body>
<script>

    function pl(id) {
       var p = prompt("请输入评论类容和星级 (0~5)，以空格分开~");
       var l = p.substring(0, p.length -2)
       var x = p.substring(p.length -1);

       location.href = "${pageContext.request.contextPath}/remark?method=add&userId=${sessionScope.user.userId}&content="+l+"&rank="+x+"&bookId="+id;
    }

</script>
<div class="user_top">
    <div class="user_c">
        <div class="user_top_l">
            <a href="../index.jsp" target="_blank">回到首页</a>
            欢迎您，${sessionScope.user.nickname}  &nbsp;&nbsp;&nbsp;
            <a href="${pageContext.request.contextPath}/user?method=exit" target="_blank">退出</a>
        </div>
        <div class="user_top_r">
            <ul>
                <li><a href="" target="_blank">帮助中心</a></li>
                <li><a href="" target="_blank">关于我们</a></li>

            </ul>
        </div>
    </div>
</div>

<div class="user_nav">
    <div class="user_c">
        <div class="user_nav_l">用户中心</div>
        <div class="user_nav_r">
            <input name="search2" type="text"  class="uesr_s"/>
            <input name="search2" type="button"  class="uesr_b"/>
        </div>
    </div>
</div>

<div class="user_cont">
    <!--left begin -->
    <div class="user_cont_left">
        <dl>
            <dt>我的交易</dt>
            <dd  class="active"><a href="">我的订单</a></dd>
            <dd><a href="${pageContext.request.contextPath}/book?method=collectQ">我的收藏</a></dd>
            <dd><a href="">我的账单</a></dd>
            <dd><a href="">我的购物车</a></dd>
            <dd><a href="">已经购买的商品</a></dd>
        </dl>
        <dl>
            <dt>自助服务</dt>
            <dd><a href="">申请查询退换货</a></dd>
            <dd><a href="">查询退换货记录</a></dd>
        </dl>
        <dl>
            <dt>我的账户</dt>
            <dd><a href="">我的积分</a></dd>
            <dd><a href="">我的消息</a></dd>
            <dd><a href="">我的收获地址</a></dd>
            <dd><a href="user_11.jsp">个人档案</a></dd>
        </dl>
        <dl>
            <dt>社区中心</dt>
            <dd><a href="${pageContext.request.contextPath}/remark?method=queryAll">我的评论</a></dd>
            <dd><a href="">兑换专区</a></dd>
        </dl>
    </div>
    <script type="text/javascript">
        $(document).ready(function(){
            $(".user_cont_left dl dt").click(function(){
                $(this).siblings().slideToggle("slow");
                $(this).toggleClass("jia"); return false;
            });

        });
    </script>
    <!--left end -->
    <!--right begin -->
    <div class="user_cont_right">
        <div class="user_lmt">
            <div class="user_lmt1">我的订单</div>

        </div>
        <div class="user_coment">
            <table width="713" border="0" cellspacing="0" cellpadding="0"  class="my_dd">
                <tr>
                    <th height="48" colspan="2">书籍</th>
                    <th width="110">订单日期</th>
                    <th width="93">订单数量</th>
                    <th width="98">订单状况</th>
                    <th width="117">实付款（元）</th>
                    <th width="115">交易操作</th>
                </tr>
                <c:forEach var="o" items="${sessionScope.orders}" varStatus="v">
                    <c:if test="${v.index >= (param.page -1) * 2 && v.index <= (param.page -1) * 2 +1}">
                        <tr>
                            <td width="32" height="195" style="border-right:none; vertical-align:text-top;">
                                <input type="hidden" name="dd_book" class="dd_book"/>
                            </td>
                            <td width="163">
                                <div class="dd_img"><a href="${pageContext.request.contextPath}/book?method=query&id=${sessionScope.books[v.index].id}" target="_blank">
                                    <img src="../../upload/${sessionScope.books[v.index].img}" width="132" height="121" /></a></div>
                                <div class="dd_bookname">
                                    <a href="${pageContext.request.contextPath}/book?method=query&id=${sessionScope.books[v.index].id}" target="_blank">${sessionScope.books[v.index].name}</a>
                                </div>
                            </td>
                            <td>${o.createTime}</td>
                            <td>${o.count}</td>
                            <c:if test="${o.status == '0'}">
                                <td>下单未付款</td>
                                <td>0</td>
                            </c:if>
                            <c:if test="${o.status == '1'}">
                                <td>已付款</td>
                                <td>${o.price * o.count}</td>
                            </c:if>

                            <td>
                                <div class="user_pj"><a href="javascript:void(0)" onclick="pl(${sessionScope.books[v.index].id})">评价</a></div>
                                <div class="user_sc"><a href="${pageContext.request.contextPath}/order?method=delete&id=${o.id}">删除</a></div>
                            </td>
                        </tr>
                    </c:if>
                </c:forEach>

            </table>
            <!--分页开始 -->
            <div style="clear:both;"></div>
            <div class="fenyeys" >
                <c:if test="${param.page > 1}">
                    <a href="user_1.jsp?page=${param.page -1}">上一页</a>
                </c:if>
                <c:if test="${param.page <= 1}">
                    <a href="">上一页</a>
                </c:if>
                <c:forEach var="i" items="${sessionScope.orders}" varStatus="v">
                    <c:if test="${v.count < sessionScope.orders.size() / 2 +1}">
                        <c:if test="${v.count == param.page + ''}">
                            <a href="user_1.jsp?page=${v.count}" class="active">${v.count}</a>
                        </c:if>
                        <c:if test="${v.count != param.page + ''}">
                            <a href="user_1.jsp?page=${v.count}" >${v.count}</a>
                        </c:if>
                    </c:if>
                </c:forEach>
                <c:if test="${param.page < sessionScope.orders.size() / 2 +1}">
                    <a href="user_1.jsp?page=${param.page +1}">下一页</a>
                </c:if>
                <c:if test="${param.page >= sessionScope.orders.size() / 2 +1}">
                    <a href="">下一页</a>
                </c:if>
            </div>
            <div style="clear:both;"></div>
            <!--分页结束 -->
        </div>
    </div>
    <!--right end -->
</div>

<div class="footer_m mar38">
    <div class="footer_nav">
        <a href="" target="_blank">关于我们</a>|
        <a href="" target="_blank">联系我们</a>|
        <a href="" target="_blank">人才招聘</a>|
        <a href="" target="_blank">广告服务</a>|
        <a href="" target="_blank">友情链接</a>|
        <a href="" target="_blank">销售联盟</a>|
        <a href="" target="_blank">公司简介</a>
    </div>
    <div class="footer_copyright">
        网络文化经营许可证鄂网文[2015]0278-060号  Copyright © 2015-2018  版权所有
    </div>
</div>
<c:if test="${param.msg == 1}">
    <script>
        alert("删除成功！")
    </script>
</c:if>
<c:if test="${param.pl == 1}">
    <script>
        alert("添加成功！")
    </script>
</c:if>
<c:if test="${param.pl == 0}">
    <script>
        alert("添加失败！")
    </script>
</c:if>
</body>
</html>